package summer.presum;

public class Solution191 {
    public int[] statisticalResult(int[] arrayA) {
        if (arrayA.length == 0) return new int[]{};
        int pre = 1;
        int n = arrayA.length;
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = pre;
            pre *= arrayA[i];
        }
        pre = arrayA[n - 1];
        for (int i = n - 2; i >= 0; i--) {
            res[i] *= pre;
            pre *= arrayA[i];
        }
        return res;
    }
}
